Skip to main content

Add Liquidity

Adding liquidity occurs in a single asset. Let's take an example of the Gas Token Index Pool (which includes all native assets of each supported chain) with the following weights:

AssetWeight PointsShare
BNB10000,1428 %
AVAX10000,1428 %
ETH10000,1428 %
MATIC10000,1428 %
FTM10000,1428 %
ETH (arbitrum)10000,1428 %
ETH (optimism)10000,1428 %

Total Weight = 1000 * 7 = 7000

To become a Liquidity Provider, one needs to choose an asset to deposit. In this example, we choose ETH.

  1. Liquidity Provider calls addLiquidity() method on ChildRouter.sol on Ethereum network.

  2. It will lock ETH tokens in InterswapLock.sol contract on Ethereum network

  3. After an Axelar message sent to MasterRouter.sol on Avalanche network (considered as masterchain) with the following payload:

{
address pool,
address token, // token for adding liquidity
uint256 amount, // amount of token
}
  1. MasterRouter.sol will get a Pool contract using poolID, then call addLiquidity() function in the InterswapPool.sol contract, which will:
  • Increase the reserves of ETH in pool state
  • Increase the weight of the ETH in the pool using formula in Dynamic Weights
  • Mint LPs on to address on masterchain

Let's take that ETH weight was increased for 50 points. After adding liquidity we can see such a picture of pool structure:

AssetWeight PointsShare
BNB10000,1418 %
AVAX10000,1418 %
ETH10500,1489 %
MATIC10000,1418 %
FTM10000,1418 %
ETH (arbitrum)10000,1418 %
ETH (optimism)10000,1418 %

Total Weight = 7050